package com.lanou.fooddemo.activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;

import com.lanou.fooddemo.R;
import com.lanou.fooddemo.util.CommonUtil;

public class StartActivity extends Activity {

    /**
     * 定义一个消息处理Handler
     */
    private Handler handler;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_start);
        //获取主题
        CommonUtil.getFoodThemeOfSharedPerferences(StartActivity.this);
        handler = new Handler(new Handler.Callback() {
            @Override
            public boolean handleMessage(Message msg) {
                //定义跳转Intent
                Intent intent = new Intent(StartActivity.this, MainTabActivity.class);
                //跳转到下一个Activity
                startActivity(intent);
                //关闭当前Activity
                finish();
                return true;
            }
        });

        //延迟发送消息，通知跳转下一个Activity，关闭当前Activity
        handler.sendMessageDelayed(handler.obtainMessage(), 3000);
    }

}
